{extend name="public/layout" /}
{block name="link"}
<link rel="stylesheet" href="__STATIC__/frame/static/css/style.css">
<link rel="stylesheet" href="__ADMIN_CSS__/public.css">
<style>
    body{
       background: url("__STATIC__/admin/news/img/6c328d092d5bbbaaf6f37e3c8a5c5d7.jpg");
    }
</style>
{/block}
{block name="main"}
<div class="login-box">
    <form class="layui-form layui-form-pane" method="get" action="" id="form">
        <!--<div class="layui-form-item">-->
            <!--<h3>后台登录系统:<a style="font-size: 10px;color: red" href="{:url('index/project')}">返回模块选择</a></h3>-->
        <!--</div>-->
        <div class="layui-form-item">
            <label class="layui-form-label">账号：</label>

            <div class="layui-input-inline">
                <input type="text" name="user" class="layui-input" lay-verify="account" placeholder="账号"
                       autocomplete="on" maxlength="20"/>
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label">密码：</label>

            <div class="layui-input-inline">
                <input type="password" name="pwd" class="layui-input" lay-verify="password" placeholder="密码"
                       maxlength="20"/>
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label">验证码：</label>

            <div class="layui-input-inline" style="text-align: center">
                <input type="text" name="code" class="layui-input" lay-verify="code" placeholder="验证码" maxlength="20"/>
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label">点击图片：</label>

            <div class="layui-input-inline" style="text-align: center">
                <img src="{:captcha_src()}" id="img" alt="" onclick="this.src='{:captcha_src()}?'+Math.random()" style="width: 90%;display: block">
            </div>
        </div>
        <div class="layui-form-item">
            <button type="reset" class="layui-btn layui-btn-danger btn-reset">重置</button>
            <button type="button" class="layui-btn btn-submit" lay-submit="" lay-filter="sub" id="tijiao">立即登录</button>
        </div>
    </form>
</div>
{/block}
{block name="script"}
<script>
    $("#tijiao").click(function () {
        // $.post("{:url('index/signins')}",{},function (res) {
        //     console.log(res);
        // })
        var index = layer.load(0, {shade: false}); //0代表加载的风格，支持0-2
        ChaJian.formToAjax($("#form"),"{:url('index/signins')}",function (res) {
            console.log(res)
            layer.close(index);
            if(res.code==200){
                layer.msg(res.msg);
                setTimeout(function () {
                    window.location.href ="{:url('index/index')}";
                },1500);
            }else{
                layer.msg(res.msg);
                $("#img").click();
            }
        })
    })
</script>
{/block}